<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of login
 *
 * @author vampired
 */
class Golib_Controller_Plugin_Login extends Zend_Controller_Plugin_Abstract {

    public function preDispatch(Zend_Controller_Request_Abstract $request) {
        $module = $request->getModuleName(); //This is the module
        $action = $request->getActionName();
        if ($module == 'admin' && !in_array($action, array('login','upload'))) {
            $session = new Zend_Session_Namespace('Default');
            if (!isset($session->status) && $session->status != 'LOGGED') {
                $redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
                $redirector->gotoUrl('/admin/index/login');
            }
        }
    }

}